package com.aiit.service.impl;


import com.aiit.dao.SysRoleDao;
import com.aiit.pojo.SysRole;
import com.aiit.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Service
public class SysRoleServiceImpl  implements SysRoleService {

    @Autowired
    SysRoleDao sysRoleDao;

    @Override
    public Set<String> listRoles(String userName) {
        List<SysRole> roles = sysRoleDao.listSysRolesByUserName(userName);
        Set<String> result = new HashSet<String>();
        for (SysRole role: roles) {
            result.add(role.getRoleName());
        }
        return result;
    }
}